Skip to content

fix: sanitize exported chat HTML content#5280

Open
aravelo7 wants to merge 1 commit into
1Panel-dev:v2from
aravelo7:v2
Open

fix: sanitize exported chat HTML content#5280
aravelo7 wants to merge 1 commit into
1Panel-dev:v2from
aravelo7:v2

Conversation

@aravelo7
Copy link
Copy Markdown

What this PR does / why we need it?

This PR sanitizes exported chat HTML content before generating downloadable .html files.

Previously, exported HTML content was generated directly from chat markdown via marked(...) without sanitization. Since exported content may contain user messages and assistant responses, raw HTML or dangerous URL schemes could persist into the exported file.

This change reduces potential export-based XSS risks in exported chat HTML files.

Summary of your change

  • Sanitize exported HTML using sanitize-html

  • Preserve common Markdown export elements:

    • headings
    • paragraphs
    • lists
    • blockquotes
    • code blocks
    • tables
    • links
    • images
  • Restrict dangerous tags, event handler attributes, and unsafe URL schemes

  • Keep the change isolated to the HTML export flow

  • Add minimal TypeScript declaration for sanitize-html

  • Update marked(markdownContent) to await marked(markdownContent) for current type compatibility

Please indicate you've done the following:

@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot Bot commented May 22, 2026

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot Bot commented May 22, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant